package com.serviceinfo.impl;

import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import com.serviceinfo.model.ParameterInfo;

public class ParameterInfoImpl implements ParameterInfo {

	private final String name;

	private final Class<?> type;

	private final List<Annotation> annotations = new ArrayList<Annotation>();

	public ParameterInfoImpl(String name, Class<?> type, List<Annotation> annotations) {

		if (name == null || type == null) {
			throw new IllegalArgumentException("Name and type cannot be null");
		}
		this.name = name;
		this.type = type;

		if (annotations != null) {
			this.annotations.addAll(annotations);
		}
	}

	public ParameterInfoImpl(String name, Class<?> type) {
		this(name, type, null);
	}

	public String getName() {
		return name;
	}

	public Class<?> getType() {
		return type;
	}

	public List<Annotation> getAnnotations() {
		return Collections.unmodifiableList(annotations);
	}

}
